// To parse this JSON data, do
//
//     final orderDetailModel = orderDetailModelFromJson(jsonString);

import 'dart:convert';

OrderDetailModel orderDetailModelFromJson(String str) => OrderDetailModel.fromJson(json.decode(str));

String orderDetailModelToJson(OrderDetailModel data) => json.encode(data.toJson());

class OrderDetailModel {
  String orderId;
  int lineId;
  DateTime createAt;
  String caption;
  String totalPrice;
  int status;
  String statusText;
  int lastPayTime;
  Operation operation;
  List<dynamic> giftGoods;

  OrderDetailModel({
    required this.orderId,
    required this.lineId,
    required this.createAt,
    required this.caption,
    required this.totalPrice,
    required this.status,
    required this.statusText,
    required this.lastPayTime,
    required this.operation,
    required this.giftGoods,
  });

  factory OrderDetailModel.fromJson(Map<String, dynamic> json) => OrderDetailModel(
    orderId: json["orderId"],
    lineId: json["lineId"],
    createAt: DateTime.parse(json["createAt"]),
    caption: json["caption"],
    totalPrice: json["totalPrice"],
    status: json["status"],
    statusText: json["statusText"],
    lastPayTime: json["lastPayTime"],
    operation: Operation.fromJson(json["operation"]),
    giftGoods: List<dynamic>.from(json["giftGoods"].map((x) => x)),
  );

  Map<String, dynamic> toJson() => {
    "orderId": orderId,
    "lineId": lineId,
    "createAt": createAt.toIso8601String(),
    "caption": caption,
    "totalPrice": totalPrice,
    "status": status,
    "statusText": statusText,
    "lastPayTime": lastPayTime,
    "operation": operation.toJson(),
    "giftGoods": List<dynamic>.from(giftGoods.map((x) => x)),
  };
}

class Operation {
  bool showGoToDetail;
  bool showGoToPay;
  bool showDelete;

  Operation({
    required this.showGoToDetail,
    required this.showGoToPay,
    required this.showDelete,
  });

  factory Operation.fromJson(Map<String, dynamic> json) => Operation(
    showGoToDetail: json["showGoToDetail"],
    showGoToPay: json["showGoToPay"],
    showDelete: json["showDelete"],
  );

  Map<String, dynamic> toJson() => {
    "showGoToDetail": showGoToDetail,
    "showGoToPay": showGoToPay,
    "showDelete": showDelete,
  };
}
